<script src="lib/vue-2.4.0.js" type="text/javascript" charset="utf-8"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>


<div id="app">
  <input type="" value="" v-model="firstname" />+
  <input type="" value="" v-model="lastname" />=
  <input type="" value="" v-model="fullname" />
</div>

<script type="text/javascript">
  var vm = new Vue({
    el: '#app',
    data: {
      firstname: '',
      lastname: '',
      fullname: '',
    },
    methods: {},
    watch: {
      firstname(newvalue, oldvalue) {
        console.log(newvalue, oldvalue)
        // 这样子会造成死循环
        setTimeout(() => {
          this.firstname++
        }, 1000)
      },
    }
  })
</script>